home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Full / NetObjects Fusion 9 Standard / NOF9_Full_EN.exe / data1.cab / FSI / lib / nof / Session.js < prev    next >
Encoding:
Text File  |  2005-11-16  |  4.3 KB  |  149 lines

  1. /****i* SOURCE_FILE/INFO
  2.   *
  3.   * NAME
  4.   *  Session.js
  5.   *
  6.   * USAGE
  7.   *  Part of Netobjects JavaScript Library.
  8.   *
  9.   * COPYRIGHT
  10.   *  Copyright ⌐ 2000-2005 Website Pros, Inc.
  11.   *  All Rights Reserved.
  12.   *
  13.   *  This is an unpublished work protected by Website Pros, Inc.
  14.   *  as a trade secret, and is not to be used or disclosed except as
  15.   *  expressly provided in a written license agreement executed by
  16.   *  you and Website Pros, Inc.
  17.   *
  18.   *      <copyright@websitepros.com>
  19.   *
  20.   * NOTES
  21.   *  JavaScript code.
  22.   *
  23.   *****/
  24.  
  25. if (!IS.isModuleInitialized("IS.NOF.Session"))
  26. {
  27.     /****h* NOF_JavaScript_Library/NOF.Session
  28.     *
  29.     * NAME
  30.     *  NOF.Session
  31.     *
  32.     * DESCRIPTION
  33.     *
  34.     * Class used to store informations (variables) during a Fusion session. 
  35.     * Session variables are available until the user exits Fusion.
  36.     *
  37.     ****/
  38.     
  39.   /**
  40.     * Constructor    
  41.     */    
  42.     function NOF_Session( ) {
  43.         this.__proto__ = NOF_Session.prototype;    
  44.     }
  45.     {
  46.         var member = NOF_Session.prototype;    
  47.         member.CLASS_NAME            = "NOF.Session";
  48.         
  49.         var method = NOF_Session.prototype;        
  50.         
  51.         /**
  52.         * Sets the value of a new or existing session variable. 
  53.         * Session variables are available until the user exits Fusion
  54.         *
  55.         * @param pName name of the variable
  56.         * @param pValue value of the session variable
  57.         **/
  58.         method.setVariable = function (/*String*/ pName, /*String*/ pValue) { 
  59.             NOF.App.getFSIApp().SetSessionVar(pName, pValue);
  60.         }        
  61.         
  62.         /**
  63.         * Returns the value of a session variable. If the variable is not defined 
  64.         * the function will return an empty string.
  65.         * 
  66.         * @param pName name of the variable
  67.         * @return the value of the pName session variable
  68.         **/
  69.         method.getVariable = function (/*String*/ pName) { 
  70.             return NOF.App.getFSIApp().GetSessionVar(pName);
  71.         }                                    
  72.         
  73.         /**
  74.         * SetPassword defines a password that can be used within URLs
  75.         * In functions accepting a URL the password can then be specified using the string:
  76.         * %pw_<passwordName>%
  77.         * If the password name is found and the context is valid the string will be replaced by 
  78.         * the actual password.
  79.         * The password is available only as long as Fusion is open.         
  80.         * 
  81.         * @param passwordName defines a name for the password
  82.         * @param password defines the actual password. 
  83.         * @param context specifies the context for the password, which means that                          
  84.         **/
  85.         method.setPassword = function (/*String*/ passwordName,/*String*/  password,/*String*/  context) { 
  86.             NOF.App.getFSIApp().SetPassword(passwordName, password, context );
  87.         }    
  88.         
  89.         /**
  90.         * HasPassword verify if a password was defined or not. 
  91.         * Passwords are defined using the function SetPassword.
  92.         * @param passwordName
  93.         * @return a boolean specifying whether a password with the specified name is defined.
  94.         **/
  95.         method.hasPassword = function (/*String*/ passwordName) { 
  96.             return NOF.App.getFSIApp().HasPassword(passwordName);
  97.         }                
  98.         
  99.         /**
  100.         * Sets a cookie (name and value) for a specific URL. 
  101.         * The cookie will be available as long as Fusion is running, or until explicitly modified or deleted.
  102.         *
  103.         * @param pUrl
  104.         * @param pName
  105.         * @param pValue
  106.         *
  107.         * @return true if cookie is succesfully set
  108.         **/
  109.         method.setCookie = function (/*String*/ pUrl,/*String*/ pName,/*String*/ pValue) { 
  110.             return NOF.App.getFSIApp().SetCookie(pUrl, pName, pValue);
  111.         }                
  112.         
  113.         /**
  114.         * Saves all cookies for a specific URL.
  115.         *  These cookies can be restored by calling RestoreCookies.
  116.         *
  117.         * @param pUrl            
  118.         **/
  119.         method.saveCookies = function (/*String*/ pUrl) { 
  120.             NOF.App.getFSIApp().SaveCookies(pUrl);
  121.         }
  122.         
  123.         /**
  124.         * Restores the cookies previously saved using saveCookies for a specific URL.             
  125.         *
  126.         * @param pUrl
  127.         * @return true if successful, and false if saveCookies has not been called for the URL.
  128.         **/
  129.         method.restoreCookies = function (/*String*/ pUrl) { 
  130.             return NOF.App.getFSIApp().RestoreCookies(pUrl);
  131.         }                
  132.         
  133.         /**
  134.         * Checks whether a cookie with the specified name is defined for the specified URL. 
  135.         * The cookie value cannot be read using this API.
  136.         *
  137.         * @param pUrl
  138.         * @param pName
  139.         * @return true if cookie is defined
  140.         **/
  141.         method.hasCookie = function (/*String*/ pUrl,/*String*/ pName) { 
  142.             return NOF.App.getFSIApp().HasCookie(pUrl, pName);
  143.         }                
  144.         
  145.     }
  146.     
  147.     NOF.__proto__.Session = new NOF_Session();
  148.     
  149. }